package org.dromara.demo;

import com.mybatisflex.codegen.entity.Table;


public class JavaGenTool {

    Table table;
    String basePackagePath;

    public JavaGenTool() {
    }

    public JavaGenTool(Table table, String basePackagePath) {
        this.table = table;
        this.basePackagePath = basePackagePath;
    }

    public String entitySuffix = "DO";
    public String boSuffix = "BO";
    public String qoSuffix = "QO";
    public String voSuffix = "VO";
    public String mapperSuffix = "Mapper";
    public String serviceSuffix = "Service";
    public String serviceImplSuffix = "ServiceImpl";
    public String controllerSuffix = "Controller";

    public String entityPackagePath = "pojo.entity";
    public String boPackagePath = "pojo.bo";
    public String qoPackagePath = "pojo.qo";
    public String voPackagePath = "pojo.vo";
    public String mapperPackagePath = "mapper";
    public String servicePackagePath = "service";
    public String serviceImplPackagePath = "service.impl";
    public String bizPackagePath = "biz";
    public String controllerPackagePath = "controller";

    public String getEntityClassName() {
        return table.getEntityJavaFileName() + entitySuffix;
    }

    public String getBoClassName() {
        return table.getEntityJavaFileName() + boSuffix;
    }

    public String getQoClassName() {
        return table.getEntityJavaFileName() + qoSuffix;
    }

    public String getVoClassName() {
        return table.getEntityJavaFileName() + voSuffix;
    }

    public String getMapperClassName() {
        return table.getEntityJavaFileName() + mapperSuffix;
    }

    public String getServiceClassName() {
        return table.getEntityJavaFileName() + serviceSuffix;
    }

    public String getServiceImplClassName() {
        return table.getEntityJavaFileName() + serviceImplSuffix;
    }

    public String getControllerClassName() {
        return table.getEntityJavaFileName() + controllerSuffix;
    }


    public String getLowerEntityClassName() {
        return getEntityClassName().replaceFirst(getEntityClassName().substring(0, 1), getEntityClassName().substring(0, 1).toLowerCase());
    }

    public String getLowerBoClassName() {
        return getBoClassName().replaceFirst(getBoClassName().substring(0, 1), getBoClassName().substring(0, 1).toLowerCase());
    }

    public String getLowerQoClassName() {
        return getQoClassName().replaceFirst(getQoClassName().substring(0, 1), getQoClassName().substring(0, 1).toLowerCase());
    }

    public String getLowerVoClassName() {
        return getVoClassName().replaceFirst(getVoClassName().substring(0, 1), getVoClassName().substring(0, 1).toLowerCase());
    }

    public String getLowerMapperClassName() {
        return getMapperClassName().replaceFirst(getMapperClassName().substring(0, 1), getMapperClassName().substring(0, 1).toLowerCase());
    }

    public String getLowerServiceClassName() {
        return getServiceClassName().replaceFirst(getServiceClassName().substring(0, 1), getServiceClassName().substring(0, 1).toLowerCase());
    }

    public String getLowerServiceImplClassName() {
        return getServiceImplClassName().replaceFirst(getServiceImplClassName().substring(0, 1), getServiceImplClassName().substring(0, 1).toLowerCase());
    }

    public String getLowerControllerClassName() {
        return getControllerClassName().replaceFirst(getControllerClassName().substring(0, 1), getControllerClassName().substring(0, 1).toLowerCase());
    }


    public String getEntityPackagePath() {
        return basePackagePath + "." + entityPackagePath;
    }

    public String getBoPackagePath() {
        return basePackagePath + "." + boPackagePath;
    }

    public String getQoPackagePath() {
        return basePackagePath + "." + qoPackagePath;
    }

    public String getVoPackagePath() {
        return basePackagePath + "." + voPackagePath;
    }

    public String getMapperPackagePath() {
        return basePackagePath + "." + mapperPackagePath;
    }

    public String getServicePackagePath() {
        return basePackagePath + "." + servicePackagePath;
    }

    public String getServiceImplPackagePath() {
        return basePackagePath + "." + serviceImplPackagePath;
    }

    public String getBizPackagePath() {
        return basePackagePath + "." + bizPackagePath;
    }
    public String getControllerPackagePath() {
        return basePackagePath + "." + controllerPackagePath;
    }
}
